/**
 * Created by ziyu on 17/3/10.
 */
import React, { Component, PropTypes } from 'react'
import {
  Table,
  Button,
  message,
  Form,
  Input,
  DatePicker,
  Select,
  Modal,
  Upload,
  Icon,
  Popconfirm,
  Spin,
  notification
} from 'antd'
import { exportFile, fetchPost } from '../../../utils/request'
import Moment from 'moment'
import { origin } from '../../../utils/config'
import auth from '../../../services/auth'
import Pannel from '../../common/components/Pannel'
import Styles from '../payBack/payBack.less'
import DlButton from '../../common/components/download/DlButton'

const FormItem = Form.Item
const { RangePicker } = DatePicker
const Option = Select.Option
const dateFormat = 'YYYY/MM/DD'
const monthFormat = 'YYYY/MM'

class LineCapitalList extends React.Component {
  constructor (props) {
    super(props)
    this.getListFun = this.getListFun.bind(this)
    this.nextpage = this.nextpage.bind(this)
    this.groupSearch = this.groupSearch.bind(this)
    this.pickerFun = this.pickerFun.bind(this)
    this.showModal = this.showModal.bind(this)
    this.handleOk = this.handleOk.bind(this)
    this.handleCancel = this.handleCancel.bind(this)
    this.exportHandleOk = this.exportHandleOk.bind(this)
    this.exportHandleCancel = this.exportHandleCancel.bind(this)
    this.showExportModal = this.showExportModal.bind(this)
    this.exportHandleChange = this.exportHandleChange.bind(this)
    this.getFundSide = this.getFundSide.bind(this)
    this.getOrderStatus = this.getOrderStatus.bind(this)
    // this.initSelectFunc = this.initSelectFunc.bind(this)
    this.getTimeChange = this.getTimeChange.bind(this)
    this.state = {
      panelParams: [
        {
          name: 'Account Balance',
          value: `- ₹`
        },
        {
          name: 'Total Loan Amount',
          value: `0 ₹`
        },
        {
          name: 'Total Transfer Amount',
          value: `0 ₹`
        }
      ],
      balance: null,
      frozenBalance: null,
      dataList: [],
      initFund: [],
      visible: false,
      page: {
        currentPage: 1,
        pageSize: 10,
        totalCount: 0
      },
      selectfundCode: '',
      verifiedStartTime: Moment().subtract(60, 'days').format('YYYY-MM-DD 00:00:00'), // 审核开始时间
      verifiedEndTime: Moment().format('YYYY-MM-DD 23:59:59'), // 审核的结束时间
      transferStartTime: null, // 打款成功时间
      transferEndTime: null, // 打款成功时间
      findType: null, // Query Type
      status: -3, // 订单状态
      inputValue: null, // 输入值
      fundCode: null, // 资金方
      rowDetail: [],
      exportVisible: false,
      exportValue: '',
      startDate: '',
      endDate: '',
      exportInit: [],
      loading: false,
      tableLoading: false,
      orderStatus: [
        {
          label: 'Waiting for assign',
          value: -3
        },
        {
          label: 'Waiting for Transfer',
          value: 0
        },
        {
          label: 'In Process',
          value: 1
        },
        {
          label: '锁住订单',
          value: -2
        },
        {
          label: 'Failed',
          value: -1
        },
        {
          label: 'Completed',
          value: 2
        }
      ],
      totalAmount: null,
      paymentIds: null,
      selectedRowKeys: [],
      buttonHidden: false,
      downloadParams: {}
    }
  }

  getDateFun (obj) {
    var t = obj
    var array = t.split('-')
    var dt = new Date(array[0], array[1], array[2])
    return dt
  }

  getListFun (data) {
    let that = this
    that.setState({
      tableLoading: true,
      downloadParams: data
    })
    fetchPost(`/finance/fund/list?currentPage=${that.state.page.currentPage}&pageSize=${that.state.page.pageSize}`, data).then((res) => {
      if (res.code === 0) {
        // message.success(res.msg)
        const { totalAmount, totalArriveAmount } = res.data
        const panelParams = [
          {
            name: 'Account Balance',
            value: !this.state.balance ? '-₹' : `${this.state.balance}(frozen:${this.state.frozenBalance})₹`
          },
          {
            name: 'Total Loan Amount',
            value: `${totalAmount || 0} ₹`
          },
          {
            name: 'Total Transfer Amount',
            value: `${totalArriveAmount || 0} ₹`
          }
        ]
        that.setState({
          dataList: res.data.prePaymentOrderVos,
          initFund: res.data.fundCodeItemList,
          page: {
            ...this.state.page,
            totalCount: res.page.totalCount || 0
          },
          totalAmount: res.data.totalAmount,
          tableLoading: false,
          panelParams
        })
      } else {
        message.error(res.msg)
        that.setState({
          tableLoading: false,
        })
      }
    })
  }

  /**
   * 查询资金账户余额
   */
  queryFundAccountBalance () {
    fetchPost('/finance/fund/account/info', { 'fundCode': this.state.fundCode }).then((res) => {
      if (res.code === 0 && res.data) {
        let balance = res.data.totalBalance
        let frozenBalance = res.data.frozenBalance
        this.setState({
          balance,
          frozenBalance
        })
      }
    })
  }

  componentDidMount () {
    this.setState({
      paymentIds: null,
      selectedRowKeys: [],
    }, () => {
      let initData = {
        'verifiedStartTime': this.state.verifiedStartTime,
        'verifiedEndTime': this.state.verifiedEndTime,
        'transferStartTime': this.state.transferStartTime,
        'transferEndTime': this.state.transferEndTime,
        'findType': null,
        'inputValue': null,
        'status': -3,
        'fundCode': null
      }
      this.queryFundAccountBalance()
      this.getListFun(initData)
    })
  }

  changeTime (time, keys) {
    console.log(time)
    console.log(keys)
  }

  getOrderStatus (e) {
    let data = this.state.orderStatus
    for (let i = 0; i < data.length; i++) {
      if (Number(data[i].value) === Number(e)) {
        return data[i].label
      }
    }
  }

  getFundSide (e) {
    let data = this.state.initFund
    for (let i = 0; i < data.length; i++) {
      if (e == null) {
        return 'No match'
      }
      if (Number(data[i].type) === Number(e)) {
        return data[i].desc
      }
    }
  }

  /**
   * 搜索
   */
  groupSearch () {
    let that = this
    const { validateFields } = that.props.form
    validateFields((errors, values) => {
      if (errors !== null) {

      } else {
        // console.log(values)
        that.setState({
          verifiedStartTime: that.state.verifiedStartTime,
          verifiedEndTime: that.state.verifiedEndTime,
          transferStartTime: that.state.transferStartTime,
          transferEndTime: that.state.transferEndTime,
          findType: values.findType === '' ? null : values.findType,
          status: values.status === '' ? null : values.status,
          inputValue: values.inputValue === '' ? null : values.inputValue,
          fundCode: values.fundCode === '' ? null : values.fundCode,
          page: {
            ...this.state.page,
            currentPage: 1
          },
          paymentIds: null,
          selectedRowKeys: [],
        }, () => {
          let obj = {
            'verifiedStartTime': that.state.verifiedStartTime,
            'verifiedEndTime': that.state.verifiedEndTime,
            'transferStartTime': that.state.transferStartTime,
            'transferEndTime': that.state.transferEndTime,
            'findType': that.state.findType,
            'inputValue': that.state.inputValue,
            'status': that.state.status,
            'fundCode': that.state.fundCode
          }
          that.getListFun(obj)
          that.queryFundAccountBalance()
        })
      }
    })
  }

  pickerFun (e, type) {
    console.log(e)
    let that = this
    if (e.length === 0) {
      if (type == 'reviewDate') {
        that.setState({
          verifiedStartTime: null,
          verifiedEndTime: null
        })
      } else if (type == 'loanDate') {
        that.setState({
          transferStartTime: null,
          transferEndTime: null
        })
      }
    } else {
      if (type == 'reviewDate') {
        that.setState({
          verifiedStartTime: Moment(e[0]).format('YYYY-MM-DD 00:00:00'),
          verifiedEndTime: Moment(e[1]).format('YYYY-MM-DD 23:59:59')
        })
      } else if (type == 'loanDate') {
        that.setState({
          transferStartTime: Moment(e[0]).format('YYYY-MM-DD 00:00:00'),
          transferEndTime: Moment(e[1]).format('YYYY-MM-DD 23:59:59')
        })
      }
    }
  }

  showModal (e) {
    this.setState({
      'visible': true,
      'rowDetail': e.orderMoveDetailVoList
    })
  }

  handleCancel () {
    this.setState({
      'visible': false
    })
  }

  handleOk () {
    this.setState({
      'visible': false
    })
  }

  nextpage (current) {
    let that = this
    that.setState({
      page: {
        ...that.state.page,
        currentPage: current
      },
      paymentIds: null,
      selectedRowKeys: [],
    }, () => {
      let obj = {
        'verifiedStartTime': that.state.verifiedStartTime,
        'verifiedEndTime': that.state.verifiedEndTime,
        'transferStartTime': that.state.transferStartTime,
        'transferEndTime': that.state.transferEndTime,
        'findType': that.state.findType,
        'inputValue': that.state.inputValue,
        'status': that.state.status,
        'fundCode': that.state.fundCode
      }
      that.getListFun(obj)
    })
  }

  showExportModal () {
    let that = this
    that.setState({
      'exportVisible': true
    })
  }

  exportHandleOk () {
    // 开始导出
    let that = this
    if (that.state.exportValue === '') {
      return message.error('请选择资金方')
    }
    that.setState({
      'exportVisible': false
    })

    let url = `${origin}/finance/exportOutCheckListToExcel?fundCode=${that.state.exportValue}&startDate=${that.state.startDate}&endDate=${that.state.endDate}`
    window.open(url)
  }

  exportHandleCancel () {
    let that = this
    that.setState({
      'exportVisible': false
    })
  }

  exportHandleChange (e) {
    let that = this
    let num = this.state.exportInit
    for (let i = 0; i < num.length; i++) {
      if (num[i] !== undefined) {
        if (parseInt(num[i].fundCode) === parseInt(e)) {
          that.setState({
            selectfundCode: num[i]
          }, () => {
            console.log('aa')
            console.log(that.state.selectfundCode)
          })
        }
      }
    }
    that.setState({
      'exportValue': e
    })
  }

  showUserInfo (info) {
    if (info.file.status !== 'uploading') {
    }
    if (info.file.status === 'done') {
      var code = info.file.response.code
      var msg = info.file.response.msg
      if (code == 0) {
        message.success(`${info.file.name} file uploaded successfully`)
      } else {
        message.error(msg)
      }
    } else if (info.file.status === 'error') {
      message.error(`${info.file.name} file upload failed.`)
    }
  }

  initSelectFunc () {
    let that = this
    fetchPost('/finance/fundPool/list').then((res) => {
      if (res.code === 0) {
        // message.success(res.msg)
        that.setState({
          exportInit: res.data.fundPoolSideVoList.map(item => {
            // 目前只能支持以下资金方导出：铜牛理财，联连，玛瑙湾理财，钜泷理财 对应 value 6，7，8，9
            if (item.fundCode === 6 || item.fundCode === 7 || item.fundCode === 8 || item.fundCode === 9 || item.fundCode === 15) {
              return item
            }
          })
        })
      } else {
        message.error(res.msg)
      }
    })
  }

  confirmPay (record) {
    fetchPost(`/pay/${record.id}/handPaid`).then((res) => {
      if (res.code === 200) {
        this.groupSearch()
      } else {
        message.error(res.msg)
        this.groupSearch()
      }
    })
  }

  onLineConfirmPay (record) {
    this.setState({
      loading: true
    })
    fetchPost(`/pay/${record.id}/payment`).then((res) => {
      this.setState({
        loading: false
      })
      if (res.code === 200) {
        this.groupSearch()
      } else {
        message.error(res.msg)
        this.groupSearch()
      }
    })
  }

  tick = () => {
    console.log('tick set run')
    this.timer && clearTimeout(this.timer)
    this.setState({
      loading: false,
    }, () => {
      this.groupSearch()

    })
  }

  componentWillUnmount () {
    //在unmount回调清除定时器
    this.timer && clearTimeout(this.timer)
  }

  confirmOnlinePayment = (transferType) => {
    if (this.state.paymentIds != null) {
      this.setState({
        loading: true
      }, () => {
        const ids = this.state.paymentIds

        const idsTmp = ids

        for (let i = 0; i < ids.length; i++) {
          fetchPost(`/pay/${ids[i]}/payment/${transferType}`).then((res) => {
            let num = 0
            if (res.code === 200) {
              //message.info("payment successful, payment id [ " + ids[i] + " ] ", 10);
            } else {
              //message.error("payment error, payment id [ " + ids[i] + " ] " + " error msg [ " + res.msg + " ] ", 10);
              let tradeNo = ''
              const dataList = this.state.dataList
              if (dataList != null) {
                dataList.map(data => {
                  if (data.id == ids[i]) {
                    tradeNo = data.orderId
                  }
                })
              }
              const args = {
                message: 'Payment Error',
                description: 'Loan id = [' + tradeNo + '], Error msg = [' + res.msg + ']',
                duration: 0,
              }
              notification.open(args)
            }

            // 以此判断执行最慢的一个fetch请求什么时候结束，结束了，修改loading
            idsTmp[i] = 0

            for (let i = 0; i < ids.length; i++) {
              if (idsTmp[i] == 0) {
                num++
              }
            }
            if (num == ids.length) {
              this.setState({
                loading: false,
              }, () => {
                this.groupSearch()

              })
            }
          })
        }
      })
    } else {
      message.info('please choose as least one item')
    }
  }
  //批量关闭订单
  confirmBatchCloseOrder = () => {
    if (this.state.paymentIds != null) {
      this.setState({
        loading: true
      }, () => {
        const ids = this.state.paymentIds

        const idsTmp = ids

        for (let i = 0; i < ids.length; i++) {
          fetchPost(`/pay/${ids[i]}/payment/close`).then((res) => {
            let num = 0
            if (res.code === 200) {
              //message.info("payment successful, payment id [ " + ids[i] + " ] ", 10);
            } else {
              //message.error("payment error, payment id [ " + ids[i] + " ] " + " error msg [ " + res.msg + " ] ", 10);
              let tradeNo = ''
              const dataList = this.state.dataList
              if (dataList != null) {
                dataList.map(data => {
                  if (data.id == ids[i]) {
                    tradeNo = data.orderId
                  }
                })
              }
              const args = {
                message: 'Payment Error',
                description: 'Loan id = [' + tradeNo + '], Error msg = [' + res.msg + ']',
                duration: 0,
              }
              notification.open(args)
            }

            // 以此判断执行最慢的一个fetch请求什么时候结束，结束了，修改loading
            idsTmp[i] = 0

            for (let i = 0; i < ids.length; i++) {
              if (idsTmp[i] == 0) {
                num++
              }
            }
            if (num == ids.length) {
              this.setState({
                loading: false,
              }, () => {
                this.groupSearch()

              })
            }
          })
        }
      })
    } else {
      message.info('please choose as least one item')
    }
  }
  //批量重绑卡
  confirmBatchRetieCard = () => {
    if (this.state.paymentIds != null) {
      this.setState({
        loading: true
      }, () => {
        const ids = this.state.paymentIds

        const idsTmp = ids

        for (let i = 0; i < ids.length; i++) {
          fetchPost(`/pay/${ids[i]}/payment/close/allowedToRetry`).then((res) => {
            let num = 0
            if (res.code === 200) {
              //message.info("payment successful, payment id [ " + ids[i] + " ] ", 10);
            } else {
              //message.error("payment error, payment id [ " + ids[i] + " ] " + " error msg [ " + res.msg + " ] ", 10);
              let tradeNo = ''
              const dataList = this.state.dataList
              if (dataList != null) {
                dataList.map(data => {
                  if (data.id == ids[i]) {
                    tradeNo = data.orderId
                  }
                })
              }
              const args = {
                message: 'Payment Error',
                description: 'Loan id = [' + tradeNo + '], Error msg = [' + res.msg + ']',
                duration: 0,
              }
              notification.open(args)
            }

            // 以此判断执行最慢的一个fetch请求什么时候结束，结束了，修改loading
            idsTmp[i] = 0

            for (let i = 0; i < ids.length; i++) {
              if (idsTmp[i] == 0) {
                num++
              }
            }
            if (num == ids.length) {
              this.setState({
                loading: false,
              }, () => {
                this.groupSearch()

              })
            }
          })
        }
      })
    } else {
      message.info('please choose as least one item')
    }
  }

  getTimeChange (e) {
    console.log('Date', e)
    let that = this
    if (e.length === 0) {
      that.setState({
        startDate: '',
        endDate: ''
      })
    } else {
      that.setState({
        startDate: Moment(e[0]).format('YYYY-MM-DD HH:mm'),
        endDate: Moment(e[1]).format('YYYY-MM-DD HH:mm')
      })
    }
  }

  confirmExport = (e) => {
    let that = this
    const { validateFields } = that.props.form
    validateFields((errors, values) => {
      if (errors !== null) {

      } else {
        // console.log(values)
        that.setState({
          buttonHidden: true,
          verifiedStartTime: that.state.verifiedStartTime,
          verifiedEndTime: that.state.verifiedEndTime,
          transferStartTime: that.state.transferStartTime,
          transferEndTime: that.state.transferEndTime,
          findType: values.findType === '' ? null : values.findType,
          status: values.status === '' ? null : values.status,
          inputValue: values.inputValue === '' ? null : values.inputValue,
          fundCode: values.fundCode === '' ? null : values.fundCode,
          page: {
            ...this.state.page,
            currentPage: 1
          }
        }, () => {
          let obj = {
            'verifiedStartTime': that.state.verifiedStartTime,
            'verifiedEndTime': that.state.verifiedEndTime,
            'transferStartTime': that.state.transferStartTime,
            'transferEndTime': that.state.transferEndTime,
            'findType': that.state.findType,
            'inputValue': that.state.inputValue,
            'status': that.state.status,
            'fundCode': that.state.fundCode
          }

          exportFile('/finance/fund/list/export', `data-${Moment().format('YYYY-MM-DD')}.xlsx`, obj).then(json => {
            this.setState({
              buttonHidden: false
            })
          })
          message.info('Downloading please wait')
        })
      }
    })
  }

  confirmExportKbData () {
    let url = `${origin}/finance/kb/data/export`
    window.open(url)
    message.info('downing....')
  }

  exportToExcel (obj) {
    let params = '?'
    let copyState = {}
    for (let i in obj) {
      if (obj[i] != '' && obj[i] != null) {
        copyState[i] = obj[i]
      }
    }
    for (let k in copyState) {
      params = params + k + '=' + copyState[k] + '&'
    }
    params = params.substring(0, params.length - 1)

    let url = `${origin}/finance/fund/list/export` + params
    window.open(url)
    message.info('downing....')
  }

  cancelExport = (e) => {
    //message.info("cancel");
  }

  onSelectChange = (selectedRowKeys, selectedRows) => {
    console.log('selectedRows: ', selectedRows)
    let ids = []
    if (selectedRows != null) {
      selectedRows.map(row => {
        ids.push(row.id)
      })
    }
    console.log(ids, 'id sssssss')
    this.setState({
      paymentIds: ids,
      selectedRowKeys
    })
  }

  render () {
    const that = this
    const { getFieldDecorator } = that.props.form
    const fundOption = this.state.initFund.map(item => {
      return (<Option key={item.type.toString()} value={item.type.toString()}>{item.desc}</Option>)
    })
    const exportOption = this.state.exportInit.map(data => {
      console.log(data)
      if (data !== undefined) {
        return (<Option key={data.fundCode.toString()} value={data.fundCode.toString()}>{data.fundName}</Option>)
      }
    })
    const columns = [
      {
        title: 'Message',
        dataIndex: 'retMsg',
        key: 'retMsg'
      }, {
        title: 'App',
        dataIndex: 'orderSource',
        key: 'orderSource'
      }, {
        title: 'Loan ID',
        dataIndex: 'orderId',
        key: 'orderId'
      }, {
        title: 'Accept No',
        dataIndex: 'acceptNo',
        key: 'acceptNo'
      }, {
        title: 'Triple No',
        dataIndex: 'tripleNo',
        key: 'tripleNo'
      }, {
        title: 'Review Pass Time',
        dataIndex: 'verifiedTime',
        key: 'verifiedTime'
      }, {
        title: 'Loan Disbursed Date',
        dataIndex: 'paidTime',
        key: 'paidTime'
      }, {
        title: 'Name',
        dataIndex: 'acctName',
        key: 'acctName'
      }, {
        title: 'Phone Number',
        dataIndex: 'mobile',
        key: 'mobile'
      }, {
        title: 'Bank Name',
        dataIndex: 'bankName',
        key: 'bankName'
      }, {
        title: 'Bank Card Number',
        dataIndex: 'cardNo',
        key: 'cardNo'
      }, {
        title: 'IFSC',
        dataIndex: 'beneficiaryIFSC',
        key: 'beneficiaryIFSC'
      }, {
        title: 'Loan Amount',
        dataIndex: 'contractAmount',
        key: 'contractAmount'
      }, {
        title: 'Transfer Amount',
        dataIndex: 'arrivalAmount',
        key: 'arrivalAmount'
      }, {
        title: 'Current Status',
        dataIndex: '',
        key: 'status',
        render: (text, record) => {
          return that.getOrderStatus(record.status)
        }
      },
      {
        fixed: 'right',
        title: 'Transfer',
        dataIndex: '',
        width: 200,
        key: '',
        render: (text, record) => {
          if (record.status !== 0 && record.status !== -1) {
            return <a href='javascript:' disabled>NONE</a>
          } else {
            return (
              <Spin spinning={this.state.loading} delay={500}>
                <div>
                  {/*<Popconfirm title='Please confirm Online  Transfer?'*/}
                  {/*            onConfirm={() => {*/}
                  {/*              this.onLineConfirmPay(record)*/}
                  {/*            }}*/}
                  {/*            okText='Online  Transfer' cancelText='Cancel'>*/}
                  {/*  <Button disabled={record.disabled} type='primary' style={{float: 'left'}}>Online</Button>*/}
                  {/*</Popconfirm>*/}
                  <Popconfirm title='Please confirm this one?'
                              onConfirm={() => {
                                this.confirmPay(record)
                              }}
                              okText='Offline Transfer' cancelText='Cancel'>
                    <Button disabled={record.disabled} type='Default'
                            style={{ float: 'left', marginLeft: 10 }}>Offline</Button>
                  </Popconfirm>
                </div>
              </Spin>
            )
          }
        }
      }
    ]
    const columns02 = [
      {
        title: 'Date',
        dataIndex: 'createDateTime',
        key: 'createDateTime'
      }, {
        title: 'Status',
        dataIndex: '',
        key: 'status',
        render: (text, record) => {
          return that.getOrderStatus(record.status)
        }
      },
      {
        title: 'Desc',
        dataIndex: 'acceptMessage',
        key: 'acceptMessage'
      }]
    // 分页
    const pagination = {
      current: this.state.page.currentPage,
      total: this.state.page.totalCount || 0,
      pageSize: this.state.page.pageSize,
      showSizeChanger: false,
      showQuickJumper: true,
      showTotal (total) {
        return `Total ${total} `
      },
      onChange (current) {
        that.nextpage(current)
      }
    }

    const { selectedRowKeys } = this.state
    const rowSelection = {
      selectedRowKeys,
      onChange: this.onSelectChange,
    }

    const excelPrams = {
      name: 'mFile',
      headers: {
        accessToken: auth.getToken()
      },
      // showUploadList: false,
      action: `${origin}/finance/fund/import`,
      // 后期考虑如何反馈信息
      onChange (info) {
        that.showUserInfo(info)
      }
    }
    return (
      <div>
        <Form layout='inline' style={{ padding: '10px 20px' }}>
          <FormItem
            label='Review Pass Time'
          >
            <RangePicker onChange={(e) => {
              this.pickerFun(e, 'reviewDate')
            }} onOpenChange={(e) => {
              console.log('chufa')
            }}
                         defaultValue={[Moment().subtract(60, 'days'), Moment()]}

            />
          </FormItem>
          <FormItem
            label='Loan Disbursed Date'
          >
            <RangePicker onChange={(e) => {
              this.pickerFun(e, 'loanDate')
            }} onOpenChange={(e) => {
              console.log('chufa')
            }}
                         defaultValue={[null, null]}

            />
          </FormItem>
          <br/>
          <div style={{ marginTop: '20px' }}/>
          <FormItem
            label='Filter'
          >
            {getFieldDecorator('findType', {
              initialValue: ''
            })(
              <Select style={{ width: 140 }}>
                <Option value=''>Please Choose</Option>
                <Option value='name'>Name</Option>
                <Option value='mobile'>Phone</Option>
                <Option value='orderId'>Loan ID</Option>
                <Option value='acceptNo'>Accept No</Option>
                <Option value='identityNo'>Aadhaar NO</Option>
                <Option value='tripleNo'>Triple No</Option>
              </Select>
            )}
          </FormItem>
          <FormItem
            label=''
          >
            {getFieldDecorator('inputValue', {
              initialValue: ''
            })(
              <Input placeholder='Please Enter' style={{ width: 180 }}/>
            )}
          </FormItem>
          <FormItem
            label='Order Status'
          >
            {getFieldDecorator('status', {
              initialValue: '-3'
            })(
              <Select style={{ width: 170 }}>
                <Option value=''>Please Choose</Option>
                <Option value='-3'>Waiting for assign</Option>
                <Option value='0'>Waiting for transfer</Option>
                <Option value='1'>In process</Option>
                {/* <Option value='-2'>锁住订单</Option> */}
                <Option value='-1'>Failed</Option>
                {/* <Option value='-11'>打款异常</Option> */}
                <Option value='2'>Completed</Option>
              </Select>
            )}
          </FormItem>
          <FormItem
            label='Sources of Funds'
          >
            {getFieldDecorator('fundCode', {
              initialValue: ''
            })(
              <Select maxTagCount="2" dropdownMenuStyle={{ maxHeight: 500 }} style={{ width: 140 }}
                      showSearch={true}
                      optionFilterProp="children"
                      filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
              >
                <Option value=''>Please Choose</Option>
                {fundOption}
              </Select>
            )}
          </FormItem>
          <FormItem>
            <Button type='primary' icon='search' onClick={() => {
              this.groupSearch()
            }}>Search</Button>
          </FormItem>
          {
            this.props.location.query.export ? (
              <DlButton downloadParams={this.state.downloadParams}
                        downloadUrl='/finance/fund/list/export/v2'/>
            ) : ''
          }
        </Form>
        <div className='mt20'>
          <Pannel panelParams={this.state.panelParams}/>
        </div>
        <Spin spinning={this.state.loading} delay={500}>
          <div style={{ marginTop: 20, marginBottom: 20, textAlign: 'right' }}>
            <Popconfirm title="Please confirm Batch Online Transfer?" placement="topLeft"
                        onConfirm={() => this.confirmOnlinePayment('IMPS')}
                        onCancel={this.cancelExport} okText="Batch Online Transfer(IMPS)" cancelText="Cancel">
              <Button type="primary" size="default">Batch Online Transfer(IMPS)</Button>
            </Popconfirm>
            {/*<Popconfirm title="Please confirm Batch Online Transfer?" placement="topLeft"*/}
            {/*            onConfirm={() => this.confirmOnlinePayment('NEFT')}*/}
            {/*            onCancel={this.cancelExport} okText="Batch Online Transfer(NEFT)" cancelText="Cancel">*/}
            {/*  <Button style={{marginLeft: 20}} type="primary" size="default">Batch Online Transfer(NEFT)</Button>*/}
            {/*</Popconfirm>*/}
            <Popconfirm title="Please confirm Batch Close Order?" placement="topLeft"
                        onConfirm={this.confirmBatchCloseOrder}
                        onCancel={this.cancelExport} okText="Batch Close Order" cancelText="Cancel">
              <Button style={{ marginLeft: 20 }} type="primary" size="default">Batch Close Order</Button>
            </Popconfirm>
            <Popconfirm title="Please confirm Batch Retie Card?" placement="topLeft"
                        onConfirm={this.confirmBatchRetieCard}
                        onCancel={this.cancelExport} okText="Batch Retie Card" cancelText="Cancel">
              <Button style={{ marginLeft: 20 }} type="primary" size="default">Batch Retie Card</Button>
            </Popconfirm>
          </div>
        </Spin>
        {/* <h1 style={{textAlign: 'right', color: '#ec5853', marginRight: '50px'}}> */}
        {/* 总金额:{this.state.totalAmount == null ? "--.--" : this.state.totalAmount}</h1> */}
        <Table
          scroll={{ x: 2000 }}
          size='small'
          pagination={pagination}
          bordered
          dataSource={this.state.dataList}
          loading={this.state.tableLoading}
          rowKey={(record, index) => index}
          columns={columns}
          rowSelection={rowSelection}
        />
        <Modal
          title='Details'
          visible={this.state.visible}
          onOk={this.handleOk}
          maskClosable
          onCancel={this.handleCancel}
        >
          <Table
            size='small'
            pagination={false}
            bordered
            dataSource={this.state.rowDetail}
            rowKey={(record, index) => index}
            columns={columns02}
          />
        </Modal>
        <Modal
          title='Export'
          visible={this.state.exportVisible}
          onOk={this.exportHandleOk}
          maskClosable
          onCancel={this.exportHandleCancel}
        >
          <Form layout='inline' style={{ padding: '10px 20px', textAlign: 'center' }}>
            <FormItem label='Choose Fund'>
              {getFieldDecorator('exportType', {
                initialValue: ''
              })(
                <Select style={{ width: 100 }} onChange={this.exportHandleChange}>
                  <Option value=''>Pls select</Option>
                  {exportOption}
                </Select>
              )}
            </FormItem>
            <FormItem label='Date' style={{ margin: '20px' }}>
              <RangePicker
                showTime={{ format: 'HH:mm' }}
                format='YYYY-MM-DD HH:mm'
                onChange={this.getTimeChange}
                onOk={this.getTimeOk}
              />
            </FormItem>
          </Form>
        </Modal>
      </div>
    )
  }

// render end
}

LineCapitalList = Form.create()(LineCapitalList)
export default LineCapitalList
